package org.zhigong.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.zhigong.dao.MenuDao;
import org.zhigong.entity.Menu;
import org.zhigong.service.MenuService;

import java.util.List;

/**
 * Created by Administrator on 2018/5/9 0009.
 */
@Service
public class MenuServiceImpl implements MenuService {

    @Autowired
    private MenuDao menuDao;

    public List<Menu> getMenuList(Menu menu) {
        return menuDao.selectByPage(menu);
    }

    public List<Menu> getMenuListAll() {
        return menuDao.getAll();
    }

    public Menu getMenuById(Long id) {
        return menuDao.queryById(id);
    }

    public Boolean addMenu(Menu menu) {
        return menuDao.insertMenu(menu) == 1;
    }

    public Boolean deleteMenu(Long id) {
        return menuDao.deleteMenu(id) == 1;
    }

    public Boolean updateMenu(Menu menu) {
        return menuDao.updateMenu(menu) == 1;
    }
}
